<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-touch-fullscreen" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="msapplication-tap-highlight" content="no"/>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1"/>
    <title>一家镖局 </title>
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/nctouch_member.css">
    <!--<link rel="stylesheet" type="text/css" href="css/verification.css">-->
</head>
<body>
<header id="header">
    <div class="header-wrap">
        <div class="header-title">
            <h1>手机注册</h1>
        </div>
    </div>
</header>
<div class="nctouch-main-layout fixed-Width">
    <div class="nctouch-inp-con mt2_8rem">
        <form action="" method="">
            <ul class="form-box">
                <li class="form-item bbd">
                    <h4>联系电话</h4>
                    <div class="input-box">
                        <input id="phone"  type="tel" placeholder="请输入联系电话" class="inp"
                                maxlength="11"/>

                    </div>
                </li>
                <li class="form-item bbd">
                    <h4>验&nbsp;证&nbsp;码</h4>
                    <div class="input-box">
                        <input type="text" placeholder="请输入验证码" class="inp"
                               id="verifyCode"  maxlength="6"/>
			            <span class="code-again">
			            	<a href="javascript: void(0);" id="getVerify">获取验证码</a>
			            </span>
                    </div>
                </li>
            </ul>
            <div class="error-tips"></div>
            <div class="form-btn"><a href="javascript:void(0);" class="btn" id="submit">立即注册</a></div>
        </form>
    </div>
    <input type="hidden" name="referurl">
</div>

<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript" src="js/layer.js"></script>

<script>
    $(function () {
        //	获取验证码
        $("#getVerify").bind("click", function () {
            if ($("#getVerify").text() != '获取验证码')
                return;
            var phoneCode = $("#phone").val();
            if (phoneCode.length == 0) {
                layer.open({
                    content: '请输入正确的手机号'
                    ,btn: '我知道了'
                });
                return;
            }
            var phone = /^(13[0-9]|147|15[012356789]|17[678]|18[02356789])[0-9]{8}$/;
            if (!phone.test(phoneCode)) {
                layer.open({
                    content: '请输入正确的手机号'
                    ,btn: '我知道了'
                });
                return;
            }
            //		倒计时
            countDownTime();
        });
        //验证码获取倒计时
        function countDownTime() {
            $('#getVerify').html('请60秒后重新获取')
            var waitTime, currTime = 59;
            var interval = setInterval(function () {
                timeChange(currTime);
                currTime--;
                if (currTime < 0) {
                    clearInterval(interval);
                    currTime = waitTime;
                }
            }, 1000);
        }

        //倒计时显示
        function timeChange(waitTime) {
            if (waitTime != 0) {
                $('#getVerify').css("background-color","#e8e8e8");
                $('#getVerify').html('请' + waitTime + '秒后重新获取');
            } else {
                $('#getVerify').html('获取验证码');
            }
        }

        $("#submit").bind("click", function () {
            var verifyCode = $("#verifyCode").val(); //验证码
            var phoneCode = $("#phone").val();	 //电话号码
            var phone = /^(13[0-9]|147|15[012356789]|17[678]|18[02356789])[0-9]{8}$/;
            if (!phone.test(phoneCode)) {
                layer.open({
                    content: '请输入正确的手机号'
                    ,btn: '我知道了'
                });
                return;
            }
            if (verifyCode.length == 0) {
                layer.open({
                    content: '请输入验证码'
                    ,btn: '我知道了'
                });
                return;
            }
           /* layer.open({
                content: '正在跳转……'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });*/
            layer.open({
                content: '您确定要刷新一下本页面吗？'
                ,btn: ['刷新', '不要']
                ,yes: function(index){
                    location.reload();
                    layer.close(index);
                }
            });

        });
    });
</script>



</body>
</html>